package com.ljw.spring.annotation.test;

import com.ljw.spring.annotation.bean.Animal;
import com.ljw.spring.annotation.bean.Car;
import com.ljw.spring.annotation.bean.Computer;
import com.ljw.spring.annotation.bean.Dog;
import com.ljw.spring.annotation.conf.ConfigOfAutowired;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @FileName IOCTest_Autowired
 * @Description TODO
 * @Author ljw
 * @Date 2021/2/2 23:55
 * @Version 1.0
 */
public class IOCTest_Autowired {


    @Test
    public void test01(){
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigOfAutowired.class);
        Dog dog = context.getBean(Dog.class);
        Animal animal = context.getBean(Animal.class);
        Car car = context.getBean(Car.class);
        Computer computer = context.getBean(Computer.class);

        System.out.println(dog);
        System.out.println("animal属性dog："+animal.getDog());
        System.out.println(car);
        System.out.println(computer);

    }



}
